<template xmlns:v-action="">
    <a-card :bordered="false">
        <div class="table-page-search-wrapper">
            <a-form layout="inline" ref="queryPmsGoodsSkuForm" :form="queryPmsGoodsSkuForm">

                <a-row :gutter="48">
                    <a-col :md="8" :sm="24">
                        <a-form-item label="SKU平台编码">
                            <a-input v-decorator="['skuCode',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="品牌ID">
                            <a-input v-decorator="['goodsId',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <template v-if="advanced">
                    <a-col :md="8" :sm="24">
                        <a-form-item label="SKU条码 商家唯一">
                            <a-input v-decorator="['skuSn',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="封面图">
                            <a-input v-decorator="['facePic',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="主图，连产品图片限制为5张，以逗号分割">
                            <a-input v-decorator="['mainPics',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="上架状态：0->下架；1->上架">
                            <a-input v-decorator="['openStatus',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="排序">
                            <a-input v-decorator="['sortNum',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="销量(延迟统计)">
                            <a-input v-decorator="['saleNum',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="市场价">
                            <a-input v-decorator="['marketPrice',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="销售价格">
                            <a-input v-decorator="['salePrice',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="规格属性一 如颜色">
                            <a-input v-decorator="['attr1',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="规格属性二 如尺码">
                            <a-input v-decorator="['attr2',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="库存">
                            <a-input v-decorator="['stock',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="锁定库存">
                            <a-input v-decorator="['lockStock',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购">
                            <a-input v-decorator="['promotionType',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="促销ID">
                            <a-input v-decorator="['promotionId',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="促销价格">
                            <a-input v-decorator="['promotionPrice',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="促销开始时间">
                            <a-input v-decorator="['promotionStartTime',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="活动限购数量">
                            <a-input v-decorator="['promotionPerLimit',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="促销结束时间">
                            <a-input v-decorator="['promotionEndTime',{ rules: [{ required: false}] }]"/>
                        </a-form-item>
                    </a-col>
                    </template>
                    <a-col :md="!advanced && 8 || 24" :sm="24">
                    <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
                      <a-button type="primary" @click="handleSearchPmsGoodsSku">查询</a-button>
                      <a-button style="margin-left: 8px" @click="handleSearchResetPmsGoodsSku">重置</a-button>
                      <a @click="toggleAdvanced" style="margin-left: 8px">
                        {{ advanced ? '收起' : '展开' }}
                        <a-icon :type="advanced ? 'up' : 'down'"/>
                      </a>
                    </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>

        <div class="table-operator">
            <a-button type="primary" v-action:pms_pmsGoodsSku_add icon="plus" @click="handleAddPmsGoodsSku">新建</a-button>
            <a-dropdown v-if="selectedRowKeys.length > 0">
                <a-menu slot="overlay">
                    <a-menu-item key="1" v-action:pms_pmsGoodsSku_delete @click="handleBatchDeletePmsGoodsSku"><a-icon type="delete" />删除</a-menu-item>
                    <!-- lock | unlock -->
                    <a-menu-item key="2"><a-icon type="lock" />扩展</a-menu-item>
                </a-menu>
                <a-button style="margin-left: 8px">
                    批量操作 <a-icon type="down" />
                </a-button>
            </a-dropdown>
        </div>

        <!-- 列表  -->
        <s-table
                ref="table"
                size="default"
                rowKey="skuId"
                :columns="columns"
                :data="loadData"
                :alert="{ show: true, clear: true }"
                :rowSelection="{ selectedRowKeys: this.selectedRowKeys, onChange: this.onSelectChange }"
        >
            <template v-for="(col, index) in columns" v-if="col.scopedSlots" :slot="col.dataIndex" slot-scope="text">
                <div :key="index">
                    <template>{{ text }}</template>
                </div>
            </template>
            <template slot="status" slot-scope="text">
                <div v-if="text==1">启用</div>
                <div v-if="text==0">关闭</div>
            </template>
            <span slot="action" slot-scope="text, record">
        <a @click="handleEditPmsGoodsSku(record)">编辑</a>
        <a-divider type="vertical" />
        <a-dropdown>
          <a class="ant-dropdown-link">
            更多 <a-icon type="down" />
          </a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a href="javascript:" @click="handleDetailPmsGoodsSku(record)" >详情</a>
            </a-menu-item>
            <a-menu-item>
              <a href="javascript:" v-if="record.statusEnable==1" @click="handleDisableStatusPmsGoodsSku(record)">关闭</a>
              <a href="javascript:" v-if="record.statusEnable==0" @click="handleDisableStatusPmsGoodsSku(record)">启用</a>
            </a-menu-item>
            <a-menu-item>
              <a href="javascript:" @click="handleDeletePmsGoodsSku(record)">删除</a>
            </a-menu-item>
          </a-menu>
        </a-dropdown>
      </span>
        </s-table>
        <!--   新建表单 -->
        <a-modal
                title="新建"
                :width="800"
                v-model="addModelVisible"
                :confirmLoading="addConfirmLoading"
                @ok="handleSavePmsGoodsSku"
        >
            <a-form :form="addPmsGoodsSkuForm">
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="ID"
                                validateStatus="success"
                                hasFeedback >
                            <a-input v-decorator="[ 'skuId',{ rules: [{ required: false, message: '主键' }] }]" disabled="disabled"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="SKU平台编码"
                                hasFeedback >
                            <a-input v-decorator="[ 'skuCode',{ rules: [{ required: false, message: 'SKU平台编码' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="品牌ID"
                                hasFeedback >
                            <a-input v-decorator="[ 'goodsId',{ rules: [{ required: false, message: '品牌ID' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="SKU条码 商家唯一"
                                hasFeedback >
                            <a-input v-decorator="[ 'skuSn',{ rules: [{ required: false, message: 'SKU条码 商家唯一' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="封面图"
                                hasFeedback >
                            <a-input v-decorator="[ 'facePic',{ rules: [{ required: false, message: '封面图' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="主图，连产品图片限制为5张，以逗号分割"
                                hasFeedback >
                            <a-input v-decorator="[ 'mainPics',{ rules: [{ required: false, message: '主图，连产品图片限制为5张，以逗号分割' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="上架状态：0->下架；1->上架"
                                hasFeedback >
                            <a-input v-decorator="[ 'openStatus',{ rules: [{ required: false, message: '上架状态：0->下架；1->上架' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="排序"
                                hasFeedback >
                            <a-input v-decorator="[ 'sortNum',{ rules: [{ required: false, message: '排序' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="销量(延迟统计)"
                                hasFeedback >
                            <a-input v-decorator="[ 'saleNum',{ rules: [{ required: false, message: '销量(延迟统计)' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="市场价"
                                hasFeedback >
                            <a-input v-decorator="[ 'marketPrice',{ rules: [{ required: false, message: '市场价' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="销售价格"
                                hasFeedback >
                            <a-input v-decorator="[ 'salePrice',{ rules: [{ required: false, message: '销售价格' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="规格属性一 如颜色"
                                hasFeedback >
                            <a-input v-decorator="[ 'attr1',{ rules: [{ required: false, message: '规格属性一 如颜色' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="规格属性二 如尺码"
                                hasFeedback >
                            <a-input v-decorator="[ 'attr2',{ rules: [{ required: false, message: '规格属性二 如尺码' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="库存"
                                hasFeedback >
                            <a-input v-decorator="[ 'stock',{ rules: [{ required: false, message: '库存' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="锁定库存"
                                hasFeedback >
                            <a-input v-decorator="[ 'lockStock',{ rules: [{ required: false, message: '锁定库存' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionType',{ rules: [{ required: false, message: '促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="促销ID"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionId',{ rules: [{ required: false, message: '促销ID' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="促销价格"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionPrice',{ rules: [{ required: false, message: '促销价格' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="促销开始时间"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionStartTime',{ rules: [{ required: false, message: '促销开始时间' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="活动限购数量"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionPerLimit',{ rules: [{ required: false, message: '活动限购数量' }] }]"/>
                        </a-form-item>
                        <a-form-item
                                :labelCol="labelCol"
                                :wrapperCol="wrapperCol"
                                label="促销结束时间"
                                hasFeedback >
                            <a-input v-decorator="[ 'promotionEndTime',{ rules: [{ required: false, message: '促销结束时间' }] }]"/>
                        </a-form-item>
                <a-divider />
            </a-form>
        </a-modal>
        <!--   编辑表单 -->
        <a-modal
                title="编辑"
                :width="800"
                v-model="editModelVisible"
                :confirmLoading="editConfirmLoading"
                @ok="handleUpdatePmsGoodsSku"
        >
            <a-form :form="editPmsGoodsSkuForm">
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="ID"
                        validateStatus="success"
                        hasFeedback >
                    <a-input v-decorator="[ 'skuId',{ rules: [{ required: false, message: '主键' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="SKU平台编码"
                        hasFeedback >
                    <a-input v-decorator="[ 'skuCode',{ rules: [{ required: false, message: 'SKU平台编码' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="品牌ID"
                        hasFeedback >
                    <a-input v-decorator="[ 'goodsId',{ rules: [{ required: false, message: '品牌ID' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="SKU条码 商家唯一"
                        hasFeedback >
                    <a-input v-decorator="[ 'skuSn',{ rules: [{ required: false, message: 'SKU条码 商家唯一' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="封面图"
                        hasFeedback >
                    <a-input v-decorator="[ 'facePic',{ rules: [{ required: false, message: '封面图' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="主图，连产品图片限制为5张，以逗号分割"
                        hasFeedback >
                    <a-input v-decorator="[ 'mainPics',{ rules: [{ required: false, message: '主图，连产品图片限制为5张，以逗号分割' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="上架状态：0->下架；1->上架"
                        hasFeedback >
                    <a-input v-decorator="[ 'openStatus',{ rules: [{ required: false, message: '上架状态：0->下架；1->上架' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="排序"
                        hasFeedback >
                    <a-input v-decorator="[ 'sortNum',{ rules: [{ required: false, message: '排序' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="销量(延迟统计)"
                        hasFeedback >
                    <a-input v-decorator="[ 'saleNum',{ rules: [{ required: false, message: '销量(延迟统计)' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="市场价"
                        hasFeedback >
                    <a-input v-decorator="[ 'marketPrice',{ rules: [{ required: false, message: '市场价' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="销售价格"
                        hasFeedback >
                    <a-input v-decorator="[ 'salePrice',{ rules: [{ required: false, message: '销售价格' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="规格属性一 如颜色"
                        hasFeedback >
                    <a-input v-decorator="[ 'attr1',{ rules: [{ required: false, message: '规格属性一 如颜色' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="规格属性二 如尺码"
                        hasFeedback >
                    <a-input v-decorator="[ 'attr2',{ rules: [{ required: false, message: '规格属性二 如尺码' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="库存"
                        hasFeedback >
                    <a-input v-decorator="[ 'stock',{ rules: [{ required: false, message: '库存' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="锁定库存"
                        hasFeedback >
                    <a-input v-decorator="[ 'lockStock',{ rules: [{ required: false, message: '锁定库存' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionType',{ rules: [{ required: false, message: '促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="促销ID"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionId',{ rules: [{ required: false, message: '促销ID' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="促销价格"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionPrice',{ rules: [{ required: false, message: '促销价格' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="促销开始时间"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionStartTime',{ rules: [{ required: false, message: '促销开始时间' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="活动限购数量"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionPerLimit',{ rules: [{ required: false, message: '活动限购数量' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-form-item
                        :labelCol="labelCol"
                        :wrapperCol="wrapperCol"
                        label="促销结束时间"
                        hasFeedback >
                    <a-input v-decorator="[ 'promotionEndTime',{ rules: [{ required: false, message: '促销结束时间' }] }]" disabled="disabled"/>
                </a-form-item>
                <a-divider />
            </a-form>
        </a-modal>
    </a-card>
</template>

<script>
    import { STable } from '@/components'
    import api from '@/api'
    import { deletePmsGoodsSku, updatePmsGoodsSku, addPmsGoodsSku, batchDeletePmsGoodsSku } from '@/api/pmsGoodsSkuApi'

    export default {
        name: 'PmsGoodsSkuList',
        data () {
        return {
            description: '',
            labelCol: {
                xs: { span: 24 },
                sm: { span: 5 }
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 16 }
            },
            queryPmsGoodsSkuForm: this.$form.createForm(this, { name: 'query_form' }),
            addModelVisible: false,
            addConfirmLoading: false,
            addPmsGoodsSkuForm: this.$form.createForm(this, { name: 'add_form' }),
            editPmsGoodsSkuForm: this.$form.createForm(this, { name: 'edit_form' }),
            editPmsGoodsSkuRecord: {},
            editModelVisible: false,
            editConfirmLoading: false,
            // 高级搜索 展开/关闭
            advanced: false,
            // 查询参数
            queryParam: {
            },
            // 表头

            columns: [
                {
                    title: 'SKU平台编码',
                    dataIndex: 'skuCode',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '品牌ID',
                    dataIndex: 'goodsId',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: 'SKU条码 商家唯一',
                    dataIndex: 'skuSn',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '封面图',
                    dataIndex: 'facePic',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '主图，连产品图片限制为5张，以逗号分割',
                    dataIndex: 'mainPics',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '上架状态：0->下架；1->上架',
                    dataIndex: 'openStatus',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '排序',
                    dataIndex: 'sortNum',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '销量(延迟统计)',
                    dataIndex: 'saleNum',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '市场价',
                    dataIndex: 'marketPrice',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '销售价格',
                    dataIndex: 'salePrice',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '规格属性一 如颜色',
                    dataIndex: 'attr1',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '规格属性二 如尺码',
                    dataIndex: 'attr2',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '库存',
                    dataIndex: 'stock',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '锁定库存',
                    dataIndex: 'lockStock',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '促销类型：0->没有促销使用原价;1->使用促销价；2->使用会员价；3->团购价；4->使用满减价格；5->限时购',
                    dataIndex: 'promotionType',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '促销ID',
                    dataIndex: 'promotionId',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '促销价格',
                    dataIndex: 'promotionPrice',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '促销开始时间',
                    dataIndex: 'promotionStartTime',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '活动限购数量',
                    dataIndex: 'promotionPerLimit',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    title: '促销结束时间',
                    dataIndex: 'promotionEndTime',
                    // width: '100',
                    sorter: false,
                    // scopedSlots: { customRender: '' },
                    needTotal: false
                },
                {
                    table: '操作',
                    dataIndex: 'action',
                    width: '150',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            // 加载数据方法 必须为 Promise 对象
            loadData: parameter => {
            return this.$http.get(api.pmsGoodsSkuUrl, {
                    params: Object.assign(parameter, this.queryParam)
                }).then(res => {
                    return res.data
                }, err => {
                this.$notification['error']({
                    message: '提示',
                    description: err.msg || '加载数据失败',
                    duration: 8
                })
              })
            },
            selectedRowKeys: [],
            selectedRows: []
        }
        },
        components: {
            STable
        },
         methods: {
             // 搜索查询
             handleSearchPmsGoodsSku () {
                 this.queryParam = this.queryPmsGoodsSkuForm.getFieldsValue()
                 this.loadData = parameter => {
                     return this.$http.get(api.pmsGoodsSkuUrl, {
                     params: Object.assign(parameter, this.queryParam)
                     }).then(res => {
                     return res.data
                     })
                 }
                 this.$refs.table.refresh()
             },
             // 搜索重置
             handleSearchResetPmsGoodsSku () {
                 this.queryPmsGoodsSkuForm.resetFields()
             },
             handleChangePmsGoodsSku (value, key, column, record) {
                 record[column.dataIndex] = value
             },
             handleEditPmsGoodsSku (record) {
                 this.editPmsGoodsSkuRecord = Object.assign({}, record)
                 this.editModelVisible = true
                 this.$nextTick(() => {
                     let values = this.editPmsGoodsSkuForm.getFieldsValue()
                     for(let key in values) {
                     values[key] = this.editPmsGoodsSkuRecord[key];
                     this.editPmsGoodsSkuForm.setFieldsValue(values)
                 }
             })
             },
             // 新增
             handleAddPmsGoodsSku () {
                 this.addPmsGoodsSkuRecord = {}
                 this.addModelVisible = true
                 this.addPmsGoodsSkuForm.resetFields();
             },
             // 批量删除
             handleBatchDeletePmsGoodsSku () {
                 // console.log('===============handleBatchDelete', this.selectedRowKeys)
                 // console.log('===============handleBatchDelete', this.selectedRowKeys[0])
                 let ids = this.selectedRowKeys
                 let params = this.selectedRowKeys
                 const that = this
                 this.$confirm({
                     title: '警告',
                     content: `真的要批量删除 ${ids.length} 个吗?`,
                     okText: '删除',
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用删除接口
                         return new Promise((resolve, reject) => {
                             batchDeletePmsGoodsSku(params)
                             .then(res => {
                                 that.$refs.table.clearSelected()
                                         that.$refs.table.refresh()
                                         that.$notification['success']({
                                             message: '提示',
                                             description: res.msg || '删除成功',
                                             duration: 8
                                         })
                                 resolve()
                             }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '删除失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             edit (row) {
                 row.editable = true
                 // row = Object.assign({}, row)
             },
             // eslint-disable-next-line
             handleDeletePmsGoodsSku (row) {
                 const that = this
                 this.$confirm({
                     title: '警告',
                     content: `真的要删除吗?`,
                     okText: '删除',
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用删除接口
                         return new Promise((resolve, reject) => {
                             deletePmsGoodsSku(row.skuId)
                     .then(res => {
                             that.$refs.table.refresh()
                                     that.$notification['success']({
                                         message: '提示',
                                         description: res.msg || '删除成功',
                                         duration: 8
                                     })
                             resolve()
                         }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '删除失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             handleDetailPmsGoodsSku (row) {
                 // console.log('============ handleDetail')
             },
             handleDisableStatusPmsGoodsSku (row) {
                 const that = this
                 let txt = row.statusEnable === 1 ? '关闭' : '启用'
                 this.$confirm({
                     title: '警告',
                     content: `真的要${txt}吗?`,
                     okText: txt,
                     okType: 'danger',
                     cancelText: '取消',
                     onOk () {
                         // 在这里调用更新接口
                         return new Promise((resolve, reject) => {
                             let params = { 'skuId': row.skuId,
                                 'statusEnable': row.statusEnable === 1 ? 0 : 1 }
                             updatePmsGoodsSku(row.skuId, params)
                     .then(res => {
                             that.$refs.table.refresh()
                                     that.$notification['success']({
                                         message: '提示',
                                         description: res.msg || '操作成功',
                                         duration: 8
                                     })
                             resolve()
                         }).catch((err) => {
                             reject(err)
                             that.$notification['error']({
                                 message: '提示',
                                 description: err.msg || '操作失败',
                                 duration: 8
                             })
                         })
                     }).catch(() => console.log('Oops errors!'))
                     },
                     onCancel () {
                         console.log('Cancel')
                     }
                 })
             },
             // 保存
             handleSavePmsGoodsSku () {
                 // console.log('model data', this.addRecord)
                 this.addPmsGoodsSkuForm.validateFields((err, values) => {
                     if (err) {
                         return;
                     }
                   //  console.log('Received values of addPmsGoodsSkuForm: ', values);
                     this.addRecord = values
                     this.addConfirmLoading = true;
                     // 新增操作
                     addPmsGoodsSku(this.editRecord)
                        .then(res => {
                         this.$notification['success']({
                             message: '提示',
                             description: res.msg || '操作成功',
                             duration: 8
                         })
                         this.addPmsGoodsSkuForm.resetFields();
                         this.addModelVisible = false;
                         this.addConfirmLoading = false;
                         this.$refs.table.refresh()
                    })
                 .catch((err) => {
                     this.addConfirmLoading = false;
                     this.$notification['error']({
                         message: '提示',
                         description: err.msg || '操作失败',
                         duration: 8
                     })
                 });
             });
             },
             // 更新
             handleUpdatePmsGoodsSku () {
                 console.log('model data', this.editRecord)
                 this.editPmsGoodsSkuForm.validateFields((err, values) => {
                     if (err) {
                         return;
                     }
                     // console.log('Received values of editPmsGoodsSkuForm: ', values);
                     this.editPmsGoodsSkuRecord = values
                     this.editConfirmLoading = true;
                     // 更新操作
                     updatePmsGoodsSku(this.editRecord.skuId, this.editRecord)
                             .then(res => {
                         this.$notification['success']({
                             message: '提示',
                             description: res.msg || '操作成功',
                             duration: 8
                         })
                         this.editPmsGoodsSkuForm.resetFields();
                         this.editModelVisible = false;
                         this.editConfirmLoading = false;
                         this.$refs.table.refresh()
                     })
                     .catch((err) => {
                             this.editConfirmLoading = false;
                         this.$notification['error']({
                             message: '提示',
                             description: err.msg || '操作失败',
                             duration: 8
                         })
                     });
                 });
             },
             onSelectChange (selectedRowKeys, selectedRows) {
                 this.selectedRowKeys = selectedRowKeys
                 this.selectedRows = selectedRows
             },
             toggleAdvanced () {
                 this.advanced = !this.advanced
             }
         }
     }
 </script>

 <style lang="less" scoped>
     .search {
         margin-bottom: 54px;
     }

     .fold {
         width: calc(100% - 216px);
         display: inline-block
     }

     .operator {
         margin-bottom: 18px;
     }

     @media screen and (max-width: 900px) {
         .fold {
             width: 100%;
         }
     }
 </style>
